// import HttpRequest from '@/libs/axios'
// import config from '@/config'
// const baseUrl = process.env.NODE_ENV === 'development' ? config.publicPath.dev : config.publicPath.pro

// const axios = new HttpRequest(baseUrl)
// export default axios
import iViewTheme from 'iview-layout-themes'
import router from '@/router'
import config from '@/config'

const baseUrl = process.env.NODE_ENV === 'development' ? config.publicPath.dev : config.publicPath.pro
const HttpRequest = iViewTheme.util.httpRequest

const axios = new HttpRequest(baseUrl, function (data) {
  if (data.errcode === 1001) {
    router.push({ name: 'login' })
  }
})
export default axios
